/*
 * Copyright OpenSearch Contributors
 * SPDX-License-Identifier: Apache-2.0
 */

package org.opensearch.sql.spark.validator;

import lombok.AllArgsConstructor;

@AllArgsConstructor
enum GrammarElement {
  ALTER_NAMESPACE("ALTER (DATABASE|TABLE|NAMESPACE)"),
  ALTER_VIEW("ALTER VIEW"),
  CREATE_NAMESPACE("CREATE (DATABASE|TABLE|NAMESPACE)"),
  CREATE_FUNCTION("CREATE FUNCTION"),
  CREATE_VIEW("CREATE VIEW"),
  DROP_NAMESPACE("DROP (DATABASE|TABLE|NAMESPACE)"),
  DROP_FUNCTION("DROP FUNCTION"),
  DROP_VIEW("DROP VIEW"),
  DROP_TABLE("DROP TABLE"),
  REPAIR_TABLE("REPAIR TABLE"),
  TRUNCATE_TABLE("TRUNCATE TABLE"),
  // DML Statements
  INSERT("INSERT"),
  LOAD("LOAD"),

  // Data Retrieval Statements
  EXPLAIN("EXPLAIN"),
  WITH("WITH"),
  CLUSTER_BY("CLUSTER BY"),
  DISTRIBUTE_BY("DISTRIBUTE BY"),
  //  GROUP_BY("GROUP BY"),
  //  HAVING("HAVING"),
  HINTS("HINTS"),
  INLINE_TABLE("Inline Table(VALUES)"),
  FILE("File"),
  INNER_JOIN("INNER JOIN"),
  CROSS_JOIN("CROSS JOIN"),
  LEFT_OUTER_JOIN("LEFT OUTER JOIN"),
  LEFT_SEMI_JOIN("LEFT SEMI JOIN"),
  RIGHT_OUTER_JOIN("RIGHT OUTER JOIN"),
  FULL_OUTER_JOIN("FULL OUTER JOIN"),
  LEFT_ANTI_JOIN("LEFT ANTI JOIN"),
  TABLESAMPLE("TABLESAMPLE"),
  TABLE_VALUED_FUNCTION("Table-valued function"),
  LATERAL_VIEW("LATERAL VIEW"),
  LATERAL_SUBQUERY("LATERAL SUBQUERY"),
  TRANSFORM("TRANSFORM"),

  // Auxiliary Statements
  MANAGE_RESOURCE("Resource management statements"),
  ANALYZE_TABLE("ANALYZE TABLE(S)"),
  CACHE_TABLE("CACHE TABLE"),
  CLEAR_CACHE("CLEAR CACHE"),
  DESCRIBE_NAMESPACE("DESCRIBE (NAMESPACE|DATABASE|SCHEMA)"),
  DESCRIBE_FUNCTION("DESCRIBE FUNCTION"),
  DESCRIBE_QUERY("DESCRIBE QUERY"),
  DESCRIBE_TABLE("DESCRIBE TABLE"),
  REFRESH_RESOURCE("REFRESH"),
  REFRESH_TABLE("REFRESH TABLE"),
  REFRESH_FUNCTION("REFRESH FUNCTION"),
  RESET("RESET"),
  SET("SET"),
  SHOW_COLUMNS("SHOW COLUMNS"),
  SHOW_CREATE_TABLE("SHOW CREATE TABLE"),
  SHOW_NAMESPACES("SHOW (DATABASES|SCHEMAS)"),
  SHOW_FUNCTIONS("SHOW FUNCTIONS"),
  SHOW_PARTITIONS("SHOW PARTITIONS"),
  SHOW_TABLE_EXTENDED("SHOW TABLE EXTENDED"),
  SHOW_TABLES("SHOW TABLES"),
  SHOW_TBLPROPERTIES("SHOW TBLPROPERTIES"),
  SHOW_VIEWS("SHOW VIEWS"),
  UNCACHE_TABLE("UNCACHE TABLE"),

  // Functions
  MAP_FUNCTIONS("Map functions"),
  CSV_FUNCTIONS("CSV functions"),
  MISC_FUNCTIONS("Misc functions"),

  // UDF
  UDF("User Defined functions");

  String description;

  @Override
  public String toString() {
    return description;
  }
}
